<template>
	<view class="contents" :style="'height:'+screenHeight+'px;'">
		<!-- <view class="header">
			<view class="yz" @click="zyfy(1)" :class="zyfys==1?'yzcshow':''">
				<span>住院缴费</span>
			</view>
			<view class="yz" @click="zyfy(2)" :class="zyfys==2?'yzcshow':''">
				<span>住院收费</span>
			</view>
		</view> -->
		<!-- <view class="list">
			当前就诊人：<span style="color: black;"></span>
		</view> -->
		<view class="lista" v-for="(item,index) in list" :key="index" @click="detil(item)">
			<view class="asj">
				<span v-if="item.zfsj">时间:&nbsp;{{item.zfsj}}</span>
				<span v-else>时间:&nbsp;{{item.date}}</span>
			</view>
			<view class="xiantiao">

			</view>
			<view class="dhje">
				<span>单号:&nbsp;{{item.jzlsh}}</span>
				<span v-if="item.zfje">费用:&nbsp;{{item.zfje}}</span>
				<span v-else>费用:&nbsp;{{item.zje}}</span>
			</view>
		</view>
		<view class="none" style="padding-top: 210rpx;" v-if="show">
			<view class="coent">
				<u-empty text="暂无信息" mode="list" icon-size="200">
				</u-empty>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: true,
				screenHeight: getApp().globalData.screenHeight-44,
				list: ''
			}
		},
		onLoad() {
			this.ZyMoney()
		},
		methods: {
			detil(e){
				console.log("单号",e)
				let jzlsh=e.jzlsh
				if(e.zje){
					uni.navigateTo({
						url:`/pages/zhuyaun/charge/chargedetil?jzlsh=${jzlsh}`
					})
				}else{
					uni.showToast({
						title: '住院缴费无详情',
						icon: 'none',
						duration: 2000
					});
				}
				
			},
			zyfy(e) {
				if (e == 1) {
					this.zyfys = e
					this.ZyJfMoney()

				} else {
					this.zyfys = e
					this.ZyMoney()
				}
			},
			ZyMoney() {
				// uni.showLoading({
				// 	title: '请稍后',
				// 	mask: true
				// });
				this.$request("auth", "ZyMoney").then(res => {
					console.log("住院收费", res)
					if (res.code == 1) {
						this.show=false
						this.list = res.data.resultdata
						uni.hideLoading();

					} else {
						this.show=true
						// uni.hideLoading();
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
					}
				}).catch(err => {
					uni.hideLoading();
					console.log("err", err)
					uni.showToast({
						title: err,
						icon: 'none',
						duration: 1000
					});

				});
			},
			ZyJfMoney() {	
				// uni.showLoading({
				// 	title: '请稍后',
				// 	mask: true
				// });
				this.$request("auth", "ZyJfMoney").then(res => {
					console.log("住院缴费", res)
					if (res.code == 1) {
						this.show=false
						this.list = res.data.resultdata
						// uni.hideLoading();

					} else {
						this.show=true
						// uni.hideLoading();
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
					}
				}).catch(err => {
					this.show=true
					uni.hideLoading();
					console.log("err", err)
					uni.showToast({
						title: err,
						icon: 'none',
						duration: 1000
					});

				});
			}
		}
	}
</script>

<style>
	@import './charge.css';
</style>